/*
 * @Author: nengwu 409791297@qq.com
 * @Date: 2020-06-26 13:48:07
 * @LastEditors: nengwu 409791297@qq.com
 * @LastEditTime: 2020-06-26 22:18:43
 * @description: 尺寸适配算法
 */

import { Dimensions, Platform, PixelRatio } from 'react-native'

const uiWidth = 750
const deviceWidth = Dimensions.get('window').width

export default function px(size) {
  if (PixelRatio.get() >= 3 && Platform.Os === 'ios' && size === 1) {
    return size
  }
  return (deviceWidth / uiWidth) * size
}
